import { defineStore } from 'pinia'
import type {aiConfig} from "/@/stores/interface/aiConfig";
import {Local} from "/@/utils/storage";

export const useAiLayoutConfig = defineStore('aiLayoutConfig', {
    state: () => {
        return {
            layout: {
                // 缩放布局
                scale: false,
                left: {
                    width: "320px",
                    mobileWidth: "320px",
                },
                bottom: {
                    height: "100px",
                    mobileHeight: "100px",
                },
            },
            message: {
                enter: true,
            }
        }
    },
    actions: {
        dataFill(state: aiConfig) {
            this.$state = { ...this.$state, ...state }
        },
        setLayout(layout: any) {
            this.$state.layout = { ...this.$state.layout, ...layout }
        },
        setLeft(left: any) {
            this.$state.layout.left = { ...this.$state.layout.left, ...left }
        },
        setBottom(bottom: any) {
            this.$state.layout.bottom = { ...this.$state.layout.bottom, ...bottom }
        },
        // 重置配置
        reset() {
            // Local.remove(this.key)
        }
    },
    persist: {
        key: 'aiLayoutConfig',
    }
})
